package portal.manager.impl;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

import portal.manager.PortalManagerUtils;
import portal.manager.service.PortalManagerService;

/**
 * 
 * @author Sorrentino
 *
 */
public class PortalManagerServiceFactory implements ServiceFactory {


	/**
	 * 
	 */
	public Object getService(Bundle bundle, ServiceRegistration sr) {

		try {

			PortalManagerUtils.loadDriver();

			PortalManagerService s = new PortalManagerServiceImpl( bundle.getBundleContext() );
			
			return s;

		} catch (Exception e) {
			Logger.global.log( Level.SEVERE,  "getService", e );
			return null;
		}

	}

	/**
	 * 
	 */
	public void ungetService(Bundle bundle, ServiceRegistration sr, Object service) {
		
	}

}
